
package com.eshop.param;


import io.swagger.annotations.ApiModelProperty;

import java.io.Serializable;

public class QueryParam implements Serializable {
    private static final long serialVersionUID = -3263921252635611410L;
    @ApiModelProperty("页码,默认为1")
    private Integer page = 1;
    @ApiModelProperty("页大小,默认为10")
    private Integer limit = 10;
    @ApiModelProperty("搜索字符串")
    private String keyword;

    @ApiModelProperty("当前第几页")
    public void setCurrent(Integer current) {
        if (current != null && current > 0) {
            this.page = current;
        } else {
            this.page = 1;
        }

    }

    public void setSize(Integer size) {
        if (size != null && size > 0) {
            this.limit = size;
        } else {
            this.limit = 10;
        }

    }

    public QueryParam() {
    }

    public Integer getPage() {
        return this.page;
    }

    public Integer getLimit() {
        return this.limit;
    }

    public String getKeyword() {
        return this.keyword;
    }

    public void setPage(final Integer page) {
        this.page = page;
    }

    public void setLimit(final Integer limit) {
        this.limit = limit;
    }

    public void setKeyword(final String keyword) {
        this.keyword = keyword;
    }

    public boolean equals(final Object o) {
        if (o == this) {
            return true;
        } else if (!(o instanceof QueryParam)) {
            return false;
        } else {
            QueryParam other = (QueryParam)o;
            if (!other.canEqual(this)) {
                return false;
            } else {
                label47: {
                    Object this$page = this.getPage();
                    Object other$page = other.getPage();
                    if (this$page == null) {
                        if (other$page == null) {
                            break label47;
                        }
                    } else if (this$page.equals(other$page)) {
                        break label47;
                    }

                    return false;
                }

                Object this$limit = this.getLimit();
                Object other$limit = other.getLimit();
                if (this$limit == null) {
                    if (other$limit != null) {
                        return false;
                    }
                } else if (!this$limit.equals(other$limit)) {
                    return false;
                }

                Object this$keyword = this.getKeyword();
                Object other$keyword = other.getKeyword();
                if (this$keyword == null) {
                    if (other$keyword != null) {
                        return false;
                    }
                } else if (!this$keyword.equals(other$keyword)) {
                    return false;
                }

                return true;
            }
        }
    }

    protected boolean canEqual(final Object other) {
        return other instanceof QueryParam;
    }

    public int hashCode() {
        boolean PRIME = true;
        int result = 1;
        Object $page = this.getPage();
        result = result * 59 + ($page == null ? 43 : $page.hashCode());
        Object $limit = this.getLimit();
        result = result * 59 + ($limit == null ? 43 : $limit.hashCode());
        Object $keyword = this.getKeyword();
        result = result * 59 + ($keyword == null ? 43 : $keyword.hashCode());
        return result;
    }

    public String toString() {
        return "QueryParam(page=" + this.getPage() + ", limit=" + this.getLimit() + ", keyword=" + this.getKeyword() + ")";
    }
}

